package com.hl.card.modular.packBack.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.hl.card.common.persistence.dao.CreditCardLogMapper;
import com.hl.card.common.persistence.model.CreditCardLog;
import com.hl.card.modular.packBack.service.CreditCardLogService;

/**
 * 交通银行信用卡错误日志
 * 
 * @author 袁伟
 *
 */
@Service
public class CreditCardLogServiceImpl implements CreditCardLogService {
	@Autowired
	private CreditCardLogMapper creditCardLogMapper;


	@Override
	public List<CreditCardLog> list(Page<CreditCardLog> page, CreditCardLog log,String sort, String order) {
		int skip = (page.getCurrent() - 1) * page.getSize();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("offset", skip);
		map.put("size", page.getSize());
		if (!StringUtils.isEmpty(sort)) {
			map.put("orderFiled", "order by " + sort + " " + order);
		}
		if (!StringUtils.isEmpty(log.getPhone())) {
			map.put("phone", log.getPhone());
		}
		page.setTotal(creditCardLogMapper.listCount(map));
		return creditCardLogMapper.list(map);
	}

}
